home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsIPermissionManager.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  7KB  |  202 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIPermissionManager.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIPermissionManager_h__
  6. #define __gen_nsIPermissionManager_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. #ifndef __gen_nsISimpleEnumerator_h__
  14. #include "nsISimpleEnumerator.h"
  15. #endif
  16.  
  17. /* For IDL files that don't want to include root IDL files. */
  18. #ifndef NS_NO_VTABLE
  19. #define NS_NO_VTABLE
  20. #endif
  21. class nsIURI; /* forward declaration */
  22.  
  23. class nsIObserver; /* forward declaration */
  24.  
  25.  
  26. /* starting interface:    nsIPermissionManager */
  27. #define NS_IPERMISSIONMANAGER_IID_STR "4f6b5e00-0c36-11d5-a535-0010a401eb10"
  28.  
  29. #define NS_IPERMISSIONMANAGER_IID \
  30.   {0x4f6b5e00, 0x0c36, 0x11d5, \
  31.     { 0xa5, 0x35, 0x00, 0x10, 0xa4, 0x01, 0xeb, 0x10 }}
  32.  
  33. class NS_NO_VTABLE nsIPermissionManager : public nsISupports {
  34.  public: 
  35.  
  36.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPERMISSIONMANAGER_IID)
  37.  
  38.   /**
  39.    * Predefined return values for the testPermission method and for
  40.    * the permission param of the add method
  41.    */
  42.   enum { UNKNOWN_ACTION = 0U };
  43.  
  44.   enum { ALLOW_ACTION = 1U };
  45.  
  46.   enum { DENY_ACTION = 2U };
  47.  
  48.   /**
  49.    * Add permission information for a given URI and permission type. This
  50.    * operation will cause the type string to be registered if it does not
  51.    * currently exist.
  52.    *
  53.    * @param uri         the uri to add the permission for
  54.    * @param type        a case-sensitive ASCII string, identifying the consumer.
  55.    *                    Consumers should choose this string to be unique, with
  56.    *                    respect to other consumers. The number of unique type
  57.    *                    indentifiers may be limited.
  58.    * @param permission  an integer from 1 to 15, representing the desired
  59.    *                    action (e.g. allow or deny). The interpretation of
  60.    *                    this number is up to the consumer, and may represent
  61.    *                    different actions for different types. Consumers may
  62.    *                    use one of the enumerated permission actions defined
  63.    *                    above. 0 is reserved for UNKNOWN_ACTION, and shouldn't
  64.    *                    be used.
  65.    * @throws            NS_ERROR_FAILURE if there is no more room for adding
  66.    *                    a new type
  67.    */
  68.   /* void add (in nsIURI uri, in string type, in PRUint32 permission); */
  69.   NS_IMETHOD Add(nsIURI *uri, const char *type, PRUint32 permission) = 0;
  70.  
  71.   /**
  72.    * Remove permission information for a given URI and permission type.
  73.    * Note that this method takes a host string, not an nsIURI.
  74.    *
  75.    * @param host   the host to remove the permission for
  76.    * @param type   a case-sensitive ASCII string, identifying the consumer. 
  77.    *               The type must have been previously registered using the
  78.    *               add() method.
  79.    */
  80.   /* void remove (in AUTF8String host, in string type); */
  81.   NS_IMETHOD Remove(const nsACString & host, const char *type) = 0;
  82.  
  83.   /**
  84.    * Clear permission information for all websites.
  85.    */
  86.   /* void removeAll (); */
  87.   NS_IMETHOD RemoveAll(void) = 0;
  88.  
  89.   /**
  90.    * Test whether a website has permission to perform the given action.
  91.    * @param uri     the uri to be tested
  92.    * @param type    a case-sensitive ASCII string, identifying the consumer
  93.    * @param return  see add(), param permission. returns UNKNOWN_ACTION when
  94.    *                there is no stored permission for this uri and / or type.
  95.    */
  96.   /* PRUint32 testPermission (in nsIURI uri, in string type); */
  97.   NS_IMETHOD TestPermission(nsIURI *uri, const char *type, PRUint32 *_retval) = 0;
  98.  
  99.   /**
  100.    * Allows enumeration of all stored permissions
  101.    * @return an nsISimpleEnumerator interface that allows access to
  102.    *         nsIPermission objects
  103.    */
  104.   /* readonly attribute nsISimpleEnumerator enumerator; */
  105.   NS_IMETHOD GetEnumerator(nsISimpleEnumerator * *aEnumerator) = 0;
  106.  
  107. };
  108.  
  109. /* Use this macro when declaring classes that implement this interface. */
  110. #define NS_DECL_NSIPERMISSIONMANAGER \
  111.   NS_IMETHOD Add(nsIURI *uri, const char *type, PRUint32 permission); \
  112.   NS_IMETHOD Remove(const nsACString & host, const char *type); \
  113.   NS_IMETHOD RemoveAll(void); \
  114.   NS_IMETHOD TestPermission(nsIURI *uri, const char *type, PRUint32 *_retval); \
  115.   NS_IMETHOD GetEnumerator(nsISimpleEnumerator * *aEnumerator); 
  116.  
  117. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  118. #define NS_FORWARD_NSIPERMISSIONMANAGER(_to) \
  119.   NS_IMETHOD Add(nsIURI *uri, const char *type, PRUint32 permission) { return _to Add(uri, type, permission); } \
  120.   NS_IMETHOD Remove(const nsACString & host, const char *type) { return _to Remove(host, type); } \
  121.   NS_IMETHOD RemoveAll(void) { return _to RemoveAll(); } \
  122.   NS_IMETHOD TestPermission(nsIURI *uri, const char *type, PRUint32 *_retval) { return _to TestPermission(uri, type, _retval); } \
  123.   NS_IMETHOD GetEnumerator(nsISimpleEnumerator * *aEnumerator) { return _to GetEnumerator(aEnumerator); } 
  124.  
  125. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  126. #define NS_FORWARD_SAFE_NSIPERMISSIONMANAGER(_to) \
  127.   NS_IMETHOD Add(nsIURI *uri, const char *type, PRUint32 permission) { return !_to ? NS_ERROR_NULL_POINTER : _to->Add(uri, type, permission); } \
  128.   NS_IMETHOD Remove(const nsACString & host, const char *type) { return !_to ? NS_ERROR_NULL_POINTER : _to->Remove(host, type); } \
  129.   NS_IMETHOD RemoveAll(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveAll(); } \
  130.   NS_IMETHOD TestPermission(nsIURI *uri, const char *type, PRUint32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->TestPermission(uri, type, _retval); } \
  131.   NS_IMETHOD GetEnumerator(nsISimpleEnumerator * *aEnumerator) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetEnumerator(aEnumerator); } 
  132.  
  133. #if 0
  134. /* Use the code below as a template for the implementation class for this interface. */
  135.  
  136. /* Header file */
  137. class nsPermissionManager : public nsIPermissionManager
  138. {
  139. public:
  140.   NS_DECL_ISUPPORTS
  141.   NS_DECL_NSIPERMISSIONMANAGER
  142.  
  143.   nsPermissionManager();
  144.  
  145. private:
  146.   ~nsPermissionManager();
  147.  
  148. protected:
  149.   /* additional members */
  150. };
  151.  
  152. /* Implementation file */
  153. NS_IMPL_ISUPPORTS1(nsPermissionManager, nsIPermissionManager)
  154.  
  155. nsPermissionManager::nsPermissionManager()
  156. {
  157.   /* member initializers and constructor code */
  158. }
  159.  
  160. nsPermissionManager::~nsPermissionManager()
  161. {
  162.   /* destructor code */
  163. }
  164.  
  165. /* void add (in nsIURI uri, in string type, in PRUint32 permission); */
  166. NS_IMETHODIMP nsPermissionManager::Add(nsIURI *uri, const char *type, PRUint32 permission)
  167. {
  168.     return NS_ERROR_NOT_IMPLEMENTED;
  169. }
  170.  
  171. /* void remove (in AUTF8String host, in string type); */
  172. NS_IMETHODIMP nsPermissionManager::Remove(const nsACString & host, const char *type)
  173. {
  174.     return NS_ERROR_NOT_IMPLEMENTED;
  175. }
  176.  
  177. /* void removeAll (); */
  178. NS_IMETHODIMP nsPermissionManager::RemoveAll()
  179. {
  180.     return NS_ERROR_NOT_IMPLEMENTED;
  181. }
  182.  
  183. /* PRUint32 testPermission (in nsIURI uri, in string type); */
  184. NS_IMETHODIMP nsPermissionManager::TestPermission(nsIURI *uri, const char *type, PRUint32 *_retval)
  185. {
  186.     return NS_ERROR_NOT_IMPLEMENTED;
  187. }
  188.  
  189. /* readonly attribute nsISimpleEnumerator enumerator; */
  190. NS_IMETHODIMP nsPermissionManager::GetEnumerator(nsISimpleEnumerator * *aEnumerator)
  191. {
  192.     return NS_ERROR_NOT_IMPLEMENTED;
  193. }
  194.  
  195. /* End of implementation class template. */
  196. #endif
  197.  
  198. #define NS_PERMISSIONMANAGER_CONTRACTID "@mozilla.org/permissionmanager;1"
  199. #define PERM_CHANGE_NOTIFICATION "perm-changed"
  200.  
  201. #endif /* __gen_nsIPermissionManager_h__ */
  202.